


import { RawProxy } from './environment'
import { isObservable } from './externals'
import { createObservable } from './internals'

export const baseHandlers = {
    get(target, key) {
        const result = target[key];
        // 如果此原生对象已经创建过代理对象了，直接返回
        const observableResult = RawProxy.get(result)
        if (observableResult) {
            return observableResult
        }
        // 如果不是一个可观察对象，那么就返回一个可观察对象
        if(!isObservable(result)){
            return createObservable(target, key, result)
        }
        return result
    },
    set(target, key, value) {

    }
}